package com.aaa.service.impl;

import com.aaa.dao.BranchMapper;
import com.aaa.entity.Branch;
import com.aaa.entity.Staff;
import com.aaa.service.BranchService;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @program: keyboard
 * @description:
 * @author: 闫克起2
 * @create: 2024-03-16 15:17
 **/
@Service
public class BranchServiceImpl implements BranchService {
    @Autowired
    private BranchMapper branchMapper;
    @Autowired
    private HttpSession session;
    public Result findAll() {
        //获取当前登录者的信息
        Staff staff = (Staff) session.getAttribute("staff");
        //不是总店的店长
        Integer branchId=null;
        if(!staff.getBranchid().equals(12138)){
             branchId=staff.getBranchid();
        }
        List<Branch> branches = branchMapper.selectAll(branchId);
        return new Result(200,"查询成功",branches);
    }
}











